package com.bjtg.threegoclinet.util;

import android.os.Environment;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by yinjianlong on 2017/9/12.
 */

public class VideoUrlPath {
    public static String VideoSavePath = Environment.getExternalStorageDirectory().getPath() + File.separator
    +"ThreeGoVideo.mp4";

    private static List<String> lstFile = new ArrayList<String>();  //结果 List

    public static List<String> getFiles(String Path, String Extension, boolean IsIterative)  //搜索目录，扩展名，是否进入子文件夹
    {
        File[] files = new File(Path).listFiles();

        for (int i = 0; i < files.length; i++) {
            File f = files[i];
            if (f.isFile()) {
                if (f.getPath().substring(f.getPath().length() - Extension.length()).equals(Extension))  //判断扩展名
                    lstFile.add(f.getPath());

                if (!IsIterative)
                    break;
            } else if (f.isDirectory() && f.getPath().indexOf("/.") == -1)  //忽略点文件（隐藏文件/文件夹）
                getFiles(f.getPath(), Extension, IsIterative);
        }
        return lstFile;
    }
}
